﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.DynamicData;
using System.Web.UI.WebControls;

namespace NotAClue.ComponentModel.DataAnnotations
{
    /// <summary>
    /// Sets Table options
    /// </summary>
    /// <remarks></remarks>
    [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
    public class TableOptionsAttribute : Attribute
    {
        private String _SetPagerValues;
        private String[] _pagerValues;

        public static TableOptionsAttribute Default = new TableOptionsAttribute();

        /// <summary>
        /// Gets or sets the rows per page.
        /// </summary>
        /// <value>The rows per page.</value>
        /// <remarks></remarks>
        public int PageSize { get; set; }

        /// <summary>
        /// Gets or sets the pager values.
        /// </summary>
        /// <value>The pager values.</value>
        /// <remarks></remarks>
        public String[] PagerValues
        {
            get { return _pagerValues; }
        }

        /// <summary>
        /// Gets or sets the enable no wrap,
        /// </summary>
        /// <value>The enable no wrap.</value>
        public Boolean EnableNoWrap { get; set; }

        public String SetPagerValues
        {
            get
            {
                return _SetPagerValues;
            }
            set
            {
                _pagerValues = value.CsvToArray();
                _SetPagerValues = value;
            }
        }

        public String FormCss { get; set; }

        //public int CommandCellColumnSpan { get; set; }

        public TableOptionsAttribute()
        {
            PageSize = 10;
            _pagerValues = new String[0];
            EnableNoWrap = false;
        }
    }
}